/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "transportista")
@NamedQueries({
    @NamedQuery(name = "Transportista.findAll", query = "SELECT t FROM Transportista t"),
    @NamedQuery(name = "Transportista.findByIdTransportista", query = "SELECT t FROM Transportista t WHERE t.idTransportista = :idTransportista"),
    @NamedQuery(name = "Transportista.findByNroDocTransportista", query = "SELECT t FROM Transportista t WHERE t.nroDocTransportista = :nroDocTransportista"),
    @NamedQuery(name = "Transportista.findByApellidoTransportista", query = "SELECT t FROM Transportista t WHERE t.apellidoTransportista = :apellidoTransportista"),
    @NamedQuery(name = "Transportista.findByNombreTransportista", query = "SELECT t FROM Transportista t WHERE t.nombreTransportista = :nombreTransportista"),
    @NamedQuery(name = "Transportista.findByDireccionTransportista", query = "SELECT t FROM Transportista t WHERE t.direccionTransportista = :direccionTransportista"),
    @NamedQuery(name = "Transportista.findByTelefono", query = "SELECT t FROM Transportista t WHERE t.telefono = :telefono")})
public class Transportista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTransportista")
    private Integer idTransportista;
    @Basic(optional = false)
    @Column(name = "nroDocTransportista")
    private int nroDocTransportista;
    @Basic(optional = false)
    @Column(name = "apellidoTransportista")
    private String apellidoTransportista;
    @Basic(optional = false)
    @Column(name = "nombreTransportista")
    private String nombreTransportista;
    @Basic(optional = false)
    @Column(name = "direccionTransportista")
    private String direccionTransportista;
    @Basic(optional = false)
    @Column(name = "telefono")
    private int telefono;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "transportista")
    private Collection<Transportetransportista> transportetransportistaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "transportista")
    private Collection<Recepcion> recepcionCollection;
    @JoinColumn(name = "idtipodoc", referencedColumnName = "idtipodocumento")
    @ManyToOne(optional = false)
    private Tipodocumento tipodocumento;
    @JoinColumn(name = "idprovincia", referencedColumnName = "idprovincia")
    @ManyToOne(optional = false)
    private Provincia provincia;
    @JoinColumn(name = "idpais", referencedColumnName = "idpais")
    @ManyToOne(optional = false)
    private Pais pais;
    @JoinColumn(name = "idlocalidad", referencedColumnName = "idlocalidad")
    @ManyToOne(optional = false)
    private Localidad localidad;

    public Transportista() {
    }

    public Transportista(Integer idTransportista) {
        this.idTransportista = idTransportista;
    }

    public Transportista(Integer idTransportista, int nroDocTransportista, String apellidoTransportista, String nombreTransportista, String direccionTransportista, int telefono) {
        this.idTransportista = idTransportista;
        this.nroDocTransportista = nroDocTransportista;
        this.apellidoTransportista = apellidoTransportista;
        this.nombreTransportista = nombreTransportista;
        this.direccionTransportista = direccionTransportista;
        this.telefono = telefono;
    }

    public Integer getIdTransportista() {
        return idTransportista;
    }

    public void setIdTransportista(Integer idTransportista) {
        this.idTransportista = idTransportista;
    }

    public int getNroDocTransportista() {
        return nroDocTransportista;
    }

    public void setNroDocTransportista(int nroDocTransportista) {
        this.nroDocTransportista = nroDocTransportista;
    }

    public String getApellidoTransportista() {
        return apellidoTransportista;
    }

    public void setApellidoTransportista(String apellidoTransportista) {
        this.apellidoTransportista = apellidoTransportista;
    }

    public String getNombreTransportista() {
        return nombreTransportista;
    }

    public void setNombreTransportista(String nombreTransportista) {
        this.nombreTransportista = nombreTransportista;
    }

    public String getDireccionTransportista() {
        return direccionTransportista;
    }

    public void setDireccionTransportista(String direccionTransportista) {
        this.direccionTransportista = direccionTransportista;
    }

    public int getTelefono() {
        return telefono;
    }

    public void setTelefono(int telefono) {
        this.telefono = telefono;
    }

    public Collection<Transportetransportista> getTransportetransportistaCollection() {
        return transportetransportistaCollection;
    }

    public void setTransportetransportistaCollection(Collection<Transportetransportista> transportetransportistaCollection) {
        this.transportetransportistaCollection = transportetransportistaCollection;
    }

    public Collection<Recepcion> getRecepcionCollection() {
        return recepcionCollection;
    }

    public void setRecepcionCollection(Collection<Recepcion> recepcionCollection) {
        this.recepcionCollection = recepcionCollection;
    }

    public Tipodocumento getTipodocumento() {
        return tipodocumento;
    }

    public void setTipodocumento(Tipodocumento tipodocumento) {
        this.tipodocumento = tipodocumento;
    }

    public Provincia getProvincia() {
        return provincia;
    }

    public void setProvincia(Provincia provincia) {
        this.provincia = provincia;
    }

    public Pais getPais() {
        return pais;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public Localidad getLocalidad() {
        return localidad;
    }

    public void setLocalidad(Localidad localidad) {
        this.localidad = localidad;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransportista != null ? idTransportista.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transportista)) {
            return false;
        }
        Transportista other = (Transportista) object;
        if ((this.idTransportista == null && other.idTransportista != null) || (this.idTransportista != null && !this.idTransportista.equals(other.idTransportista))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Transportista[idTransportista=" + idTransportista + "]";
    }

}
